package com.seeyon.apps.lzmzj.manager.impl;

import com.seeyon.ctp.portal.sso.SSOLoginHandshakeAbstract;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.util.Date;

/**
 * 
 * <p>Title: SSOLoginHandshakeImpl
 * <p>Description: 单点登录
 * <p>Copyright: Copyright (c) 2019
 * @author wangp
 * @date 2023-03-28 
 * @version TODO
 */
public class CustomssoLoginHandshakeImpl extends SSOLoginHandshakeAbstract {

    private static final Log log = LogFactory.getLog(CustomssoLoginHandshakeImpl.class);
	/**
	 * {@inheritDoc}
	 */
	public String handshake(String ticket) {
		try {
			if(ticket == null || ticket.equals("")) {
				log.info("单点登录token为空， 登录时间：" + (new Date()));
				return null;
			} else {
				log.info("当前登陆人员ticket========"+ ticket);
				if(ticket.contains("##")){
					String[] split = ticket.split("##");
					String id = split[1];
					if(id != null){
						log.info("认证通过============人员登录名为:"+ id);
						return id;
					}
				}
			}
		} catch (Exception e) {
			log.error("单点登录失败：", e);
		}
		return null;
	}

	@Override
	public void logoutNotify(String arg0) {
	}
}
